feat: make engines configurable via --engine CLI flags#8
Conversation
Previously, Run() hardcoded three engines (sqlite, postgres, mysql), which forced all callers to generate wrappers for all three databases. This became a problem for stowix/uar which dropped MySQL support — sqlc-multi-db would still try to open mysqldb/ directories that no longer exist. This change: - Adds a repeatable --engine name:package flag to the CLI so callers opt in to exactly the engines they need. - Removes the hardcoded engines slice from generator.Run(), passing it as a parameter instead. - Exits with a fatal error when no --engine flags are provided. - Updates README.md to document the new --engine flag and updated library API.
|
This change is part of the following stack: Change managed by git-spice. |
Summary of ChangesHello, I'm Gemini Code Assist1! I'm currently reviewing this pull request and will post my feedback shortly. In the meantime, here's a summary to help you and other reviewers quickly get up to speed! This pull request significantly enhances the Highlights
Using Gemini Code AssistThe full guide for Gemini Code Assist can be found on our documentation page, here are some quick tips. Invoking Gemini You can request assistance from Gemini at any point by creating a comment using either
Customization To customize Gemini Code Assist for GitHub experience, repository maintainers can create a configuration file and/or provide a custom code review style guide (such as PEP-8 for Python) by creating and adding files to a Limitations & Feedback Gemini Code Assist may make mistakes. Please leave feedback on any instances where its feedback is incorrect or counter productive. You can react with 👍 and 👎 on @gemini-code-assist comments. If you're interested in giving your feedback about your experience with Gemini Code Assist for GitHub and other Google products, sign up here. Footnotes
|
Codecov Report❌ Patch coverage is
Additional details and impacted files@@ Coverage Diff @@
## main #8 +/- ##
==========================================
- Coverage 29.21% 28.83% -0.38%
==========================================
Files 6 6
Lines 688 697 +9
==========================================
Hits 201 201
- Misses 476 485 +9
Partials 11 11 ☔ View full report in Codecov by Sentry. 🚀 New features to boost your workflow:
|
There was a problem hiding this comment.
Code Review
This pull request introduces a valuable feature by making the database engines configurable via CLI flags, which significantly increases the tool's flexibility. The implementation is solid. I have a couple of suggestions to enhance the CLI argument handling in main.go for better robustness and to ensure consistency in the documentation within README.md.
- Use flag.NArg() and flag.Arg() for cleaner argument validation - Call flag.Usage() on error instead of duplicating the message - Use full package path in go tool examples for consistency Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Previously, Run() hardcoded three engines (sqlite, postgres, mysql),
which forced all callers to generate wrappers for all three databases.
This became a problem for stowix/uar which dropped MySQL support —
sqlc-multi-db would still try to open mysqldb/ directories that no
longer exist.
This change:
in to exactly the engines they need.
as a parameter instead.
library API.